A strange crackme with surprises! We see that the Register Button is greyed - we could easily patch this with a resource editor, but that's for newbies only (see info). Let's have a closer look at the imports: We see RegisterHotkey - interesting! We find this in the listing:
004012C7 6A 51 push 51h ; 'Q'
004012C9 6A 03 push 3 ; CTRL-ALT
004012CB 68 81 00 00 00 push 81h
004012D0 53 push ebx
004012D1 E8 F4 8B 00 00 call j_RegisterHotKey
004012D6 85 C0 test eax, eax
004012D8 0F 85 E3 00 00 00 jnz loc_4013C1
The API-Reference is very helpful in this case:
BOOL RegisterHotKey
(
HWND hWnd, // window to receive hot-key notification
All characters of our name are shifted to the right and added. Note that they are signed characters. The sum must be 20Ah. Is this the case it enables the register button and executes the second call:
He, what's this! The crackme decrypts part of itself at address 401237. It xors our name with the code there - seems that we have to type in a unlock code first and then press Ctrl-Alt-Q to enable our button and to decrypt a part of the code.
Let's have a look at the serial algo first. In the listing we search for another occurence of GetDlgItemTextA, there are only two:
00401272 C6 05 EC A0 40 00+ mov byte_40A0EC, 1 ; set flag
00401279 5F pop edi
0040127A 5E pop esi
0040127B 5B pop ebx
0040127C 59 pop ecx
0040127D 5D pop ebp
0040127E C3 retn
The byte at address 40123B must be 8Ah. After that check the crackme reads our name and serial and executes the decrypted code. At address 401272 it sets a flag. The flag is being tested in the maincode after the return:
* to set the flag we have to jump to address 401272
The opcode reference tells us, that "mov r8, r8" begins with 8Ah. That's what we need for the third byte. We could do the following:
401239: A4 5A --> 8A C3 mov al, bl ; dummy code (same as below to make things easier)
40123B: EF 6A --> 8A C3 mov al, bl ; dummy code, byte [40123B] must be 8Ah!
40123D: 3E 67 --> EB 33 jmp 401272 ; jump to location where flag is being set
Now we can calculate the first part of our unlock code:
u[0]: A4 xor 8A = 2E
u[1]: 5A xor C3 = 99
u[2]: EF xor 8A = 65
u[3]: 6A xor C3 = A9
u[4]: 3E xor EB = D5
u[5]: 67 xor 33 = 54
When we trace in softice we see that this unlock code adds to zero. We have to add some more characters to get our sum of 20Ah. The decrypted code doesn't matter because of the jump. I played a bit with my calculator:
u[6]..u[23] = 3A
Unlock: .Öe⌐╒T::::::::::::::::::
*********************************
a) start crackme
b) type in unlock Code
c) press Ctrl-Alt-Q
d) type in name and any serial
e) press register button
f) REGISTERED!
Strange things happen to our keyboard while playing with this crackme and my unlock code. Maybe my solution wasn't what detten had in mind - anyway, it works fine and you don't even need a keygen!